# https://leetcode-cn.com/problems/jewels-and-stones/
# 771. 宝石与石头
class Solution:
    def numJewelsInStones(self, jewels: str, stones: str) -> int:
        stonesDist={}
        for v in stones:
            if stonesDist.get(v) is not None:
                stonesDist[v]+=1
            else:
                stonesDist[v] = 1
        sum=0
        for j in jewels:
            if stonesDist.get(j) is not None:
                sum+=stonesDist[j]
        print(sum)
        return sum



if __name__ == '__main__':
    j = "aA"
    s = "aAAbbbb"
    Solution().numJewelsInStones(j,s)